package com.yc.yyds.servlet;

import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipayTradePagePayResponse;
import com.google.gson.Gson;
import com.yc.yyds.Bean.Message;
import com.yc.yyds.Bean.Result;
import com.yc.yyds.biz.SaveIndentBiz;
import com.yc.yyds.util.AlipayTradePagePay;
import com.yc.yyds.util.ToJsonUtil;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.UUID;

/**
 * 手机扫码支付
 */
@WebServlet(name = "AlipayServlet", value = "/AlipayServlet")
public class AlipayServlet extends HttpServlet {
    Message msg =new Message();
    SaveIndentBiz biz = new SaveIndentBiz();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");

        try {
            final AlipayTradePagePayResponse pay = AlipayTradePagePay.alipay();
            response.getWriter().append(pay.getBody());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
